home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
Borland Visual dBASE Professiona v7.0
/
DATA1.CAB
/
Sample_dBASE
/
Mugs
/
Invoice.wfm
< prev
next >
Wrap
Text File
|
1997-11-20
|
14KB
|
562 lines
//--------------------------------------------------------------
//
// Invoice.wfm - Mugs Sample Application
//
// Data entry from for Invoice table.
//
// Dependencies: MUGS.CFM
// INVOICE.DMD
//
// Visual dBASE Samples Group
//
// $Revision: 1.19 $
//
// Copyright (c) 1997, Borland International, Inc.
// All rights reserved.
//
//---------------------------------------------------------------
SET TALK OFF
** END HEADER -- do not remove this line
//
// Generated on 10/23/97
//
parameter bModal
local f
f = new invoiceForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class invoiceForm of MUGSDATACFORM from "MUGS.CFM"
with (this)
onClose = class::FORM_ONCLOSE
open = class::FORM_OPEN
height = 20
left = 2
top = 0.5
width = 76
text = "Invoice - Data Entry"
endwith
this.DMINVOICE = new DATAMODREF()
this.DMINVOICE.parent = this
with (this.DMINVOICE)
filename = "INVOICE.DMD"
dataModClass = "InvoiceDataModule"
share = 0
active = true
left = -0.1429
top = -0.0455
endwith
with (this.BOOK1)
height = 18
left = 1
width = 74
metric = 0
endwith
with (this.BOOK1.GRIDROWS)
dataLink = parent.parent.DMINVOICE.ref.invoice1.rowset
metric = 0
endwith
this.BOOK1.LABELID = new TEXT(this.BOOK1)
with (this.BOOK1.LABELID)
height = 1
left = 2
top = 2
width = 10
metric = 0
colorNormal = "BtnText"
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
text = "Invoice #:"
endwith
this.BOOK1.ENTRYID = new ENTRYFIELD(this.BOOK1)
with (this.BOOK1.ENTRYID)
enabled = false
height = 1
left = 11.5
top = 2
width = 9
metric = 0
dataLink = parent.parent.DMINVOICE.ref.invoice1.rowset.fields["Invoice ID"]
picture = "9999999"
colorHighLight = ""
fontName = "MS Sans Serif"
fontSize = 8
validRequired = true
borderStyle = 7
endwith
this.BOOK1.LABELDATE = new TEXT(this.BOOK1)
with (this.BOOK1.LABELDATE)
height = 1
left = 33
top = 2
width = 10
metric = 0
colorNormal = "BtnText"
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
text = "Order Date:"
endwith
this.BOOK1.LABELCUST = new TEXT(this.BOOK1)
with (this.BOOK1.LABELCUST)
height = 1
left = 2
top = 3.5
width = 10
metric = 0
colorNormal = "BtnText"
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
text = "Customer:"
endwith
this.BOOK1.ENTRYCUSTOMER = new ENTRYFIELD(this.BOOK1)
with (this.BOOK1.ENTRYCUSTOMER)
enabled = false
height = 1
left = 21
top = 3.5
width = 23
metric = 0
colorHighLight = ""
fontName = "MS Sans Serif"
fontSize = 8
value = "CUSTOMERNAME"
validRequired = true
borderStyle = 7
endwith
this.BOOK1.BUTTONCUSTOMER = new PUSHBUTTON(this.BOOK1)
with (this.BOOK1.BUTTONCUSTOMER)
onClick = class::BUTTONCUSTOMER_ONCLICK
onOpen = {;this.text="";this.enabled = ( TYPE("this.form.app") == "O" )}
height = 1.2
left = 45
top = 3.4
width = 4
text = " "
metric = 0
upBitmap = "RESOURCE #148"
disabledBitmap = "RESOURCE #149"
fontSize = 8
speedTip = "Select Customer"
group = true
colorNormal = "BtnText/BtnFace"
value = false
endwith
this.BOOK1.RECTANGLE1 = new RECTANGLE(this.BOOK1)
with (this.BOOK1.RECTANGLE1)
left = 1
top = 5
width = 72
height = 5.5
metric = 0
text = "Payment"
colorNormal = "WindowText/BtnFace"
fontName = "MS Sans Serif"
fontSize = 8
endwith
this.BOOK1.RADIOVISA = new RADIOBUTTON(this.BOOK1)
with (this.BOOK1.RADIOVISA)
onChange = class::PAYMENT_ONCHANGE
transparent = false
height = 1
left = 3
top = 6
width = 19
text = "Visa"
metric = 0
colorNormal = "WindowText/BtnFace"
fontName = "MS Sans Serif"
fontSize = 8
group = true
value = true
endwith
this.BOOK1.RADIOMC = new RADIOBUTTON(this.BOOK1)
with (this.BOOK1.RADIOMC)
onChange = class::PAYMENT_ONCHANGE
transparent = false
height = 1
left = 3
top = 7
width = 19
text = "MasterCard"
metric = 0
colorNormal = "WindowText/BtnFace"
fontName = "MS Sans Serif"
fontSize = 8
group = false
value = false
endwith
this.BOOK1.RADIODISCOVER = new RADIOBUTTON(this.BOOK1)
with (this.BOOK1.RADIODISCOVER)
onChange = class::PAYMENT_ONCHANGE
transparent = false
height = 1
left = 3
top = 8
width = 19
text = "Discover/NOVUS"
metric = 0
colorNormal = "WindowText/BtnFace"
fontName = "MS Sans Serif"
fontSize = 8
group = false
value = false
endwith
this.BOOK1.RADIOCHECK = new RADIOBUTTON(this.BOOK1)
with (this.BOOK1.RADIOCHECK)
onChange = class::PAYMENT_ONCHANGE
transparent = false
height = 1
left = 3
top = 9
width = 19
text = "Check"
metric = 0
colorNormal = "WindowText/BtnFace"
fontName = "MS Sans Serif"
fontSize = 8
group = false
value = false
endwith
this.BOOK1.LABELCARDNAME = new TEXT(this.BOOK1)
with (this.BOOK1.LABELCARDNAME)
height = 1
left = 25
top = 6
width = 19
metric = 0
colorNormal = "BtnText"
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
text = "Name of Cardholder:"
endwith
this.BOOK1.ENTRYCARDNAME = new ENTRYFIELD(this.BOOK1)
with (this.BOOK1.ENTRYCARDNAME)
height = 1
left = 45
top = 6
width = 25
metric = 0
dataLink = parent.parent.DMINVOICE.ref.invoice1.rowset.fields["Card Name"]
colorHighLight = ""
fontName = "MS Sans Serif"
fontSize = 8
validRequired = true
borderStyle = 7
endwith
this.BOOK1.LABELCARDNO = new TEXT(this.BOOK1)
with (this.BOOK1.LABELCARDNO)
height = 1
left = 25
top = 7
width = 19
metric = 0
colorNormal = "BtnText"
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
text = "Card Number:"
endwith
this.BOOK1.ENTRYCARDNUMBER = new ENTRYFIELD(this.BOOK1)
with (this.BOOK1.ENTRYCARDNUMBER)
height = 1
left = 45
top = 7
width = 25
metric = 0
dataLink = parent.parent.DMINVOICE.ref.invoice1.rowset.fields["Card Number"]
colorHighLight = ""
fontName = "MS Sans Serif"
fontSize = 8
validRequired = true
borderStyle = 7
endwith
this.BOOK1.LABELCARDDATE = new TEXT(this.BOOK1)
with (this.BOOK1.LABELCARDDATE)
height = 1
left = 25
top = 8
width = 19
metric = 0
colorNormal = "BtnText"
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
text = "Expiration Date:"
endwith
this.BOOK1.ENTRYCARDEXP = new ENTRYFIELD(this.BOOK1)
with (this.BOOK1.ENTRYCARDEXP)
height = 1
left = 45
top = 8
width = 12
metric = 0
dataLink = parent.parent.DMINVOICE.ref.invoice1.rowset.fields["Card Exp"]
colorHighLight = ""
fontName = "MS Sans Serif"
fontSize = 8
validRequired = true
borderStyle = 7
endwith
this.BOOK1.CHECKLABEL = new TEXT(this.BOOK1)
with (this.BOOK1.CHECKLABEL)
height = 0.8235
left = 25
top = 9
width = 19
metric = 0
colorNormal = "BtnText"
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
text = "Check#"
endwith
this.BOOK1.SPINCHECK = new SPINBOX(this.BOOK1)
with (this.BOOK1.SPINCHECK)
enabled = false
height = 1
left = 45
top = 9
width = 12
metric = 0
dataLink = parent.parent.DMINVOICE.ref.invoice1.rowset.fields["Check Number"]
picture = "99999999"
colorHighLight = ""
fontName = "MS Sans Serif"
fontSize = 8
validRequired = true
endwith
this.BOOK1.LABELITEMS = new TEXT(this.BOOK1)
with (this.BOOK1.LABELITEMS)
height = 1
left = 1
top = 11
width = 10
metric = 0
colorNormal = "BtnText"
transparent = true
fontName = "MS Sans Serif"
fontSize = 8
text = "Lineitems:"
endwith
this.BOOK1.GRIDITEMS = new GRID(this.BOOK1)
with (this.BOOK1.GRIDITEMS)
bgColor = "white"
dataLink = parent.parent.DMINVOICE.ref.lineitem1.rowset
height = 5
left = 12
top = 11
width = 60
metric = 0
endwith
this.BOOK1.SPINORDERDATE = new SPINBOX(this.BOOK1)
with (this.BOOK1.SPINORDERDATE)
height = 1
left = 45
top = 2
width = 12
metric = 0
dataLink = parent.parent.DMINVOICE.ref.invoice1.rowset.fields["Order Date"]
colorHighLight = ""
rangeMax = {03/20/98}
rangeMin = {12/10/97}
fontName = "MS Sans Serif"
fontSize = 8
validRequired = true
borderStyle = 7
endwith
this.BOOK1.ENTRYCUSTOMERID = new ENTRYFIELD(this.BOOK1)
with (this.BOOK1.ENTRYCUSTOMERID)
enabled = false
height = 1
left = 11.5
top = 3.5
width = 9
metric = 0
dataLink = parent.parent.DMINVOICE.ref.customer1.rowset.fields["Customer ID"]
picture = "9999999"
colorHighLight = ""
fontName = "MS Sans Serif"
fontSize = 8
borderStyle = 7
endwith
this.rowset = this.DMINVOICE.ref.invoice1.rowset
// {Linked Method} form.book1.buttoncustomer.onClick
function BUTTONCUSTOMER_OnClick
local rInvoice, nID
rInvoice = this.form.DMINVOICE.ref.invoice1.rowset
nID = this.form.rowset.fields["Customer ID"].value
d = null
nID := this.form.app.openCustomerSelectDialog( nID )
if ( nID == -1 )
// user wants to add a new new customer
nID := null
d = new CustomerForm()
d.newID = null
d.app = this
d.mdi := false
d.rowset.beginAppend()
d.readmodal()
nID := d.newID
endif
if ( nID <> null )
try
rInvoice.fields["CUSTOMER ID"].value = nID
rInvoice.save()
catch ( Exception e )
// catch lock errors
MSGBOX( "Unable to update Invoice table.", "Alert", 0 )
rInvoice.abandon()
endtry
rInvoice.refreshControls()
endif
return
// {Linked Method} form.open
function Form_Open
local bOpen
this.rowset.form = this
this.rowset.onNavigate := class::Form_onNavigate
// Create calculated field for the customer name
// and link it to an entry field.
f = new Field()
with (f)
fieldName := "Customer Name"
beforeGetValue := ;
{ || RTRIM( IIF( this.parent["First Name"].value == null,;
"", this.parent["First Name"].value ) ) ;
+ SPACE(1) + IIF( this.parent["Last Name"].value == null,;
"", this.parent["Last Name"].value ) }
endwith
this.DMINVOICE.ref.customer1.rowset.fields.add( f )
this.book1.entryCustomer.dataLink := f
this.title.text := "<h2>Invoice</h2>"
return ( SUPER::FORM_OPEN() )
// {Linked Method} form.onClose
function Form_onClose
this.rowset.form := null // remove extra reference
return ( this.rowset.form )
function Form_OnNavigate
local payField, bCheck
payField = this.fields["Pay Type"]
bCheck = false
if ( not this.endOfSet )
bCheck = ( payField.value == "CH" )
with ( this.form.book1 )
radioMC.value := ( payField.value == "MC" )
radioVISA.value := ( payField.value == "VI" )
radioCheck.value := ( payField.value == "CH" )
radioDiscover.value := ( payField.value == "DN" )
endwith
endif
with ( this.form.book1 )
ENTRYCARDNUMBER.enabled := ( NOT bCheck )
ENTRYCARDNAME.enabled := ( NOT bCheck )
ENTRYCARDEXP.enabled := ( NOT bCheck )
SPINCHECK.enabled := ( bCheck )
endwith
return ( bCheck )
// {Linked Method} form.book1.radiocheck.onChange
// {Linked Method} form.book1.radiodiscover.onChange
// {Linked Method} form.book1.radiomc.onChange
// {Linked Method} form.book1.radiovisa.onChange
function Payment_OnChange
local bCheck, payField
bCheck = this.form.book1.radioCheck.value
payField = this.form.rowset.fields["Pay Type"]
with ( this.form.book1 )
ENTRYCARDNUMBER.enabled := ( NOT bCheck )
ENTRYCARDNAME.enabled := ( NOT bCheck )
ENTRYCARDEXP.enabled := ( NOT bCheck )
SPINCHECK.enabled := ( bCheck )
endwith
do case
case ( this.form.book1.radioMC.value )
payField.value = "MC"
case ( this.form.book1.radioVISA.value )
payField.value = "VI"
case ( this.form.book1.radioDiscover.value )
payField.value = "DN"
case ( this.form.book1.radioCheck.value )
payField.value = "CH"
endcase
return ( bCheck )
endclass